.container{
    width:100px;
    border:1px solid #ccc;
    .div1{
      height:50px;
      width:50px;
      background-color: aquamarine;
      float:left;
    position:sticky;
    top:20px
    }
  }

.container::after{
    content: "";
    display: block;
    clear: both;
}